(Quick Reference)

securityIdentity

Available in Controllers, Domains, Taglibs and Services

Returns the identity representing the current user. This is typically a user ID/username or email address.

The implementation of this method is provided by the security provider you have installed, and the type of the object is entirely dependent on this.

Usage

class PurchaseService {
    def getPurchases() {
        Purchase.findAllByEmail(securityIdentity)
    }
    …
}

Here the securityIdentity value is assumed to be an email address that is used to identify Purchases.